Database tips

Foreign Key constraints violation.

When customers implement Oracle dump during operational activity, it often produces inconsistent dump.
It happens when a parent table got exported prior to its child.
In the dump, the child table may contain "orphan" records.
Such a scenario leads to losing a "Foreign Key" constraint when a dump gets restored on a test system.

There is a way to avoid it:How to perform a consistent data export

There are also two scripts that fix such discrepancy: FindDatabaseFkIntegrityProblems FixDatabaseFkIntegrity (.

Example of lines in log indicating this may be the issue - This was seen after upgrading from N4 2.5.7.1 to 2.5.7.5 on a customer test environment and unsuccessfully starting up the Center node for the first time:

2014-07-23 13:26:59,656 FATAL [main ] [DefaultSessionFactory:603] ( ) Unsuccessful schema statement: alter table inv_move_event add constraint FKA2793DBAFF4B8D15 foreign key (mve_gkey) references srv_event java.sql.SQLIntegrityConstraintViolationException: ORA-02298: cannot validate (GLTINV.FKA2793DBAFF4B8D15) - parent keys not found